#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtQuickControls2/QQuickStyle>
#include "src/utils/httputils.h"

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    // 设置全局样式
    QQuickStyle::setStyle("Basic");
    // 注册自定义控件
    qmlRegisterType<HttpUtils>("MyUtils", 1, 0, "HttpUtils");
    QQmlApplicationEngine engine;
    const QUrl url(QStringLiteral("qrc:/src/main.qml"));
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                     &app, [url](QObject *obj, const QUrl &objUrl) {
                if (!obj && url == objUrl)
                    QCoreApplication::exit(-1);
            }, Qt::QueuedConnection);
    engine.load(url);

    return app.exec();
}
